import React from 'react';
import {isUndefined} from '../../utils/Tools';

import Icon from '../../components/Icon';
import Tree from '../../components/Tree';

import './style/index.scss';//引入样式文件

class Slide extends React.Component{

    constructor(props){
        super(props);

        this.state = {
            list: [
                {
                    title: '快速上手',
                    // icon: 'iconfont icon-plus',
                },
                {
                    title: '项目实战',
                },
                {
                    title: '组件',
                    children: [
                        {
                            title: '图标'
                        },
                        {
                            title: '按钮'
                        }
                    ]

                }
            ]
        };
    }

    componentDidMount(){

    }

    itemClick(item) {
        if (!item.children) {
            item.components = (<div className="active"></div>);
            if (this.lastItem !== item) {
                this.lastItem && (this.lastItem.components = "");
                this.lastItem = item;
            }
        }
    }

    render(){
        const props = {
            itemClick: this.itemClick.bind(this),
            dataSrc: this.state.list
        }
        return <div className="slide-container">
                <Tree abc="1231" {...props} />
            </div>
    }
}

export default Slide;

